﻿Public Class login1
    Inherits System.Web.UI.Page

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

    End Sub

    Protected Sub BtAdd_Click(ByVal sender As Object, ByVal e As EventArgs) Handles BtAdd.Click
        Dim dataSet As New DataSet()
        Dim sqlCommand = "select * from Users where Username='" & TxUsername.Text.ToString().Replace("'", "''") & "' and Password='" & TxPassword.Text.ToString().Replace("'", "''") & "'"
        Dim oleDataAdapter As New OleDb.OleDbDataAdapter(sqlCommand, ConfigurationManager.ConnectionStrings("Outletsdb").ConnectionString)
        oleDataAdapter.Fill(dataSet, "Users")
        If dataSet.Tables("Users").Rows.Count > 0 Then
            Session("Username") = TxUsername.Text
            Session("Login") = "True"
            Response.Redirect("default.aspx")
        Else
            LbResult.Text = "Login failed"

        End If
    End Sub
End Class